
export const UIplugins = { // // 封装UI框架插件
  // 提示信息
  message: function({
		message = '提示信息', 
		type = 'none', 
		time = 2000,
		closeCallback = function(){}
	} = {}) {
		switch (type) {
			case 'success': type = 'success'; break;
			case 'error': type = 'none'; break;
			case 'loading': type = 'loading'; break;
			default: type = 'none'; break;
		};
		uni.showToast({
			title: message,
			icon: type,
			duration: time,
			complete: closeCallback
		});
	},
  // 控制页面滚动
	scrollTo: function({
		scrollTop = 0, 
		duration = 0,
		closeCallback = function(){}
	} = {}) {
		uni.pageScrollTo({
				scrollTop: scrollTop,
				duration: duration
		});
		setTimeout( () => {
			typeof(closeCallback) == 'function' && closeCallback();
		}, duration);
	},
	// 预览图片
	previewImage: function({
		currentSrc, 
		images = [currentSrc]
	} = {}) {
		uni.previewImage({
			current: currentSrc,
			urls: images
		});
	},
};